// Demonstrate the short-circuit operators
class SCops {
    public static void main(String args[]) {
        int n, d;

        n = 10;
        d = 2;
        
        if(d != 0 && (n % d) == 0) 
            System.out.println(d + " is a factor of n.");
            
        d = 0;

        // Since d = 0, the second operand is not evaluated.
        if(d != 0 && (n % d) == 0) 
            System.out.println(d + " is a factor of n.");
            

        /* 
         * Now, try the same thing without a short-circuit operator.
         * This causes a divide-by-zero error.
         */ 
        if(d != 0 & (n % d) == 0)
            System.out.println(d + " is a factor of n.");
    }
}
